package com.yanqu.road.entity.activity.springdraw.config;

import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;

import java.util.ArrayList;
import java.util.List;

public class SpringDrawDigRewardConfig {

    /**
     * 活动id
     */
    private int activityId;

    /**
     * 关卡
     */
    private int level;

    /**
     * 挖一次消耗
     */
    private int cost;

    /**
     * 通关奖励道具id数量;道具id数量;道具id数量
     */
    private String rewardList;
    private Property passFixedReward = new Property(); //通关奖励：固定

    private List<Property> passSelfSelectRewardList = new ArrayList<>();//通关奖励：自选

    /**
     * 预览大奖预览大奖0不显示＞0则显示第几个
     */
    private int isReview;

    /**
     * 连线道具道具ID数量
     */
    private String reward1;
    private Property reward1Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward2;
    private Property reward2Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward3;
    private Property reward3Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward4;
    private Property reward4Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward5;
    private Property reward5Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward6;
    private Property reward6Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward7;
    private Property reward7Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward8;
    private Property reward8Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward9;
    private Property reward9Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward10;
    private Property reward10Property;

    /**
     * 连线道具道具ID数量
     */
    private String reward11;
    private Property reward11Property;

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getActivityId() {
        return activityId;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getLevel() {
        return level;
    }

    public void setCost(int cost) {
        this.cost = cost;
    }

    public int getCost() {
        return cost;
    }

    public void setRewardList(String rewardList) {
        this.rewardList = rewardList;
    }

    public String getRewardList() {
        return rewardList;
    }

    public void setIsReview(int isReview) {
        this.isReview = isReview;
    }

    public int getIsReview() {
        return isReview;
    }

    public void setReward1(String reward1) {
        this.reward1 = reward1;
    }

    public String getReward1() {
        return reward1;
    }

    public void setReward2(String reward2) {
        this.reward2 = reward2;
    }

    public String getReward2() {
        return reward2;
    }

    public void setReward3(String reward3) {
        this.reward3 = reward3;
    }

    public String getReward3() {
        return reward3;
    }

    public void setReward4(String reward4) {
        this.reward4 = reward4;
    }

    public String getReward4() {
        return reward4;
    }

    public void setReward5(String reward5) {
        this.reward5 = reward5;
    }

    public String getReward5() {
        return reward5;
    }

    public void setReward6(String reward6) {
        this.reward6 = reward6;
    }

    public String getReward6() {
        return reward6;
    }

    public void setReward7(String reward7) {
        this.reward7 = reward7;
    }

    public String getReward7() {
        return reward7;
    }

    public void setReward8(String reward8) {
        this.reward8 = reward8;
    }

    public String getReward8() {
        return reward8;
    }

    public void setReward9(String reward9) {
        this.reward9 = reward9;
    }

    public String getReward9() {
        return reward9;
    }

    public void setReward10(String reward10) {
        this.reward10 = reward10;
    }

    public String getReward10() {
        return reward10;
    }

    public void setReward11(String reward11) {
        this.reward11 = reward11;
    }

    public String getReward11() {
        return reward11;
    }

    public Property getReward1Property() {
        return reward1Property;
    }

    public void setReward1Property(Property reward1Property) {
        this.reward1Property = reward1Property;
    }

    public Property getReward2Property() {
        return reward2Property;
    }

    public void setReward2Property(Property reward2Property) {
        this.reward2Property = reward2Property;
    }

    public Property getReward3Property() {
        return reward3Property;
    }

    public void setReward3Property(Property reward3Property) {
        this.reward3Property = reward3Property;
    }

    public Property getReward4Property() {
        return reward4Property;
    }

    public void setReward4Property(Property reward4Property) {
        this.reward4Property = reward4Property;
    }

    public Property getReward5Property() {
        return reward5Property;
    }

    public void setReward5Property(Property reward5Property) {
        this.reward5Property = reward5Property;
    }

    public Property getReward6Property() {
        return reward6Property;
    }

    public void setReward6Property(Property reward6Property) {
        this.reward6Property = reward6Property;
    }

    public Property getReward7Property() {
        return reward7Property;
    }

    public void setReward7Property(Property reward7Property) {
        this.reward7Property = reward7Property;
    }

    public Property getReward8Property() {
        return reward8Property;
    }

    public void setReward8Property(Property reward8Property) {
        this.reward8Property = reward8Property;
    }

    public Property getReward9Property() {
        return reward9Property;
    }

    public void setReward9Property(Property reward9Property) {
        this.reward9Property = reward9Property;
    }

    public Property getReward10Property() {
        return reward10Property;
    }

    public void setReward10Property(Property reward10Property) {
        this.reward10Property = reward10Property;
    }

    public Property getReward11Property() {
        return reward11Property;
    }

    public void setReward11Property(Property reward11Property) {
        this.reward11Property = reward11Property;
    }

    /**
     * 获取连线奖励
     * @param lineCode
     * @return
     */
    public Property getLineReward(int lineCode) {
        switch (lineCode) {
            case 1 : return this.getReward1Property();
            case 2 : return this.getReward2Property();
            case 3 : return this.getReward3Property();
            case 4 : return this.getReward4Property();
            case 5 : return this.getReward5Property();
            case 6 : return this.getReward11Property();
            case 7 : return this.getReward10Property();
            case 8 : return this.getReward9Property();
            case 9 : return this.getReward8Property();
            case 10 : return this.getReward7Property();
            case 11 : return this.getReward6Property();
        }
        return null;
    }

    public Property getPassFixedReward() {
        return passFixedReward;
    }

    public List<Property> getPassSelfSelectReward() {
        return passSelfSelectRewardList;
    }

    /**
     * 通关奖励改成含有自选奖励的格式
     * 用竖杠（|）表示之前的为自选奖励
     * 例如配110111=60;110281=2|110281=2;110213=10
     * 则代表110111和110281在自选框里 110281和110213为单独的奖励
     * 配110277=1;123376=5;110281=2
     *  则表示三个都是固定奖励
     * 配110279=5;110016=2;110017=2|110210=5;110213=10;110200=10|110136=1;110137=1
     * 则代表110279,110016,110017在一号自选框 110210 110213 110200在二号自选框
     * 110136和110137为两个固定奖励
     * 配110279=5;110016=2;110017=2|110210=5;110213=10;110200=10|110136=1;110137=1|
     * 则表示110279,110016,110017在一号自选框 110210 110213 110200在二号自选框
     * 110136和110137在三号自选框
     */
    public void parsePassReward() {
        String[] rewardList = this.getRewardList().split("\\|");
        if (rewardList.length <= 0) {
            return;
        }
        if (rewardList.length == 1) {
            this.passFixedReward = PropertyHelper.parseStringToProperty(rewardList[0]);
            return;
        }
        //固定奖励
        this.passFixedReward = PropertyHelper.parseStringToProperty(rewardList[rewardList.length - 1]);
        //自选奖励
        for (int i = 0; i < rewardList.length - 1; i++) {
            this.passSelfSelectRewardList.add(PropertyHelper.parseStringToProperty(rewardList[i]));
        }
    }
}
